home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Cream of the Crop 22
/
Cream of the Crop 22.iso
/
doom
/
server_1.zip
/
_EXITRLS.QC
< prev
next >
Wrap
Text File
|
1996-10-04
|
7KB
|
204 lines
/*
**
** _exitrls.qc (ExitRules Code, 1.1)
**
** Copyright (C) 1996 Johannes Plass
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 2 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
**
** Author: Johannes Plass (plass@dipmza.physik.uni-mainz.de)
**
*/
//==============================================================
// Defaults
//==============================================================
float EXITRULES_FRAGLIMIT = 40; // Players can exit only if at least one
// player has at least this many frags.
// Must be >= 0
float EXITRULES_TIMELIMIT = 1; // Players can exit only if at least this many
// minutes passed on the current level.
// Must be >= 0.1
//==============================================================
// ExitRulesInfo
//==============================================================
void(entity player) ExitRulesInfo =
{
if (!USE_MODULE_EXITRULES) return;
// 123456789#123456789#123456789#12345678
sprint(player,"£");
sprint(player," ExitRules");
sprint(player, " restricts exiting.\n");
sprint(player," Type 'help-exitrules' for help.\n");
};
//==============================================================
// ExitRulesInit
//==============================================================
void(entity player) ExitRulesInit =
{
if (!USE_MODULE_EXITRULES) return;
stuffcmd(player,"alias help-exitrules \"impulse 210\";\n");
};
//==============================================================
// ExitRulesActiveMessage
//==============================================================
void(entity player) ExitRulesActiveMessage =
{
if (!USE_MODULE_EXITRULES) return;
// 123456789#123456789#123456789#12345678
sprint(player," ExitRules (help-exitrules)\n");
};
//==============================================================
// ExitRulesHelp
//==============================================================
void(entity player) ExitRulesHelp =
{
if (!USE_MODULE_EXITRULES) return;
// 123456789#123456789#123456789#12345678
sprint(player,"ExitRules:");
sprint(player, " imposes restrictions on\n");
sprint(player,"exiting a level. Current rules are:\n");
sprint(player," ");
ExitRulesLevelInfo(player);
if (USE_MODULE_VOTE && USE_SUBMODULE_VOTE_EXITRULES) { //#jp#(Vote)
// 123456789#123456789#123456789#12345678 //#jp#(Vote)
sprint(player,"ExitRules may be disabled by voting\n"); //#jp#(Vote)
sprint(player,"via the command 'vote-exitrules'.\n"); //#jp#(Vote)
} //#jp#(Vote)
};
//==============================================================
// ExitRulesLevelInfo
//==============================================================
void(entity player) ExitRulesLevelInfo =
{
if (!USE_MODULE_EXITRULES) return;
if (exitrules_status == EXITRULES_STATUS_TIGHT) {
local string tmpstr;
// 123456789#123456789#123456789#12345678
sprint(player,"ExitRules: ");
sprint(player, "before you can exit one\n");
sprint(player,"player must have ");
tmpstr = ftos(exitrules_fraglimit);
sprint(player,tmpstr);
sprint(player," frags.\n");
} else if (exitrules_status == EXITRULES_STATUS_SOFT) {
sprint(player,"ExitRules:");
sprint(player, " you can exit.\n");
}
};
//==============================================================
// ExitRulesSetValues
//==============================================================
void() ExitRulesSetValues =
{
if (exitrules_inited) return;
exitrules_inited = 1;
if (!USE_MODULE_EXITRULES) return;
// exitrules are not sensible if 'noexit' is active
if (cvar("noexit")) {
exitrules_status = EXITRULES_STATUS_DISABLED;
// disable exitrules for start level and levels with no exit
} else if (world.model == "maps/start.bsp") {
exitrules_status = EXITRULES_STATUS_SOFT;
} else if (world.model == "maps/end.bsp") {
exitrules_status = EXITRULES_STATUS_DISABLED;
} else if (world.model == "maps/dm1.bsp") {
exitrules_status = EXITRULES_STATUS_DISABLED;
} else if (world.model == "maps/dm2.bsp") {
exitrules_status = EXITRULES_STATUS_DISABLED;
} else if (world.model == "maps/dm3.bsp") {
exitrules_status = EXITRULES_STATUS_DISABLED;
} else if (world.model == "maps/dm4.bsp") {
exitrules_status = EXITRULES_STATUS_DISABLED;
} else if (world.model == "maps/dm5.bsp") {
exitrules_status = EXITRULES_STATUS_DISABLED;
} else if (world.model == "maps/dm6.bsp") {
exitrules_status = EXITRULES_STATUS_DISABLED;
} else {
exitrules_status = EXITRULES_STATUS_TIGHT;
exitrules_fraglimit = EXITRULES_FRAGLIMIT;
exitrules_timelimit = EXITRULES_TIMELIMIT;
}
};
//==============================================================
// ExitRulesExitingIsNotAllowed
//==============================================================
float(entity player) ExitRulesExitingIsNotAllowed =
{
if (!USE_MODULE_EXITRULES) return(0);
player.exitrules_death = 2;
if (exitrules_status == EXITRULES_STATUS_DISABLED) {
player.exitrules_death = 0;
} else if (exitrules_status == EXITRULES_STATUS_SOFT) {
player.exitrules_death = 0;
} else if (exitrules_maxfrags >= exitrules_fraglimit) {
player.exitrules_death = 0;
}
if (!player.exitrules_death) {
if (time < exitrules_timelimit*60) {
player.exitrules_death = 1;
}
}
return(player.exitrules_death);
};
//==============================================================
// ExitRulesClientObituary
//==============================================================
void(entity player) ExitRulesClientObituary =
{
if (player.exitrules_death == 1) {
bprint (player.netname);
bprint(" tried to exit before ");
bprint(ftos(exitrules_timelimit));
if (exitrules_timelimit == 1) bprint(" minute");
else bprint(" minutes");
bprint(" had passed on this level.\n");
} else {
bprint (player.netname);
bprint(" tried to exit before ");
bprint(ftos(exitrules_fraglimit));
bprint(" frags were reached.\n");
}
player.exitrules_death = 0;
};